From c0c63c171bc6f269943849c7fcdcee9679877529 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 7 May 2008 10:06:06 +0000 Subject: [PATCH] API: * (bug 13993) apfrom doesn't work for apdir=descending * Also removed unnecessary ORDER BY page_namespace which caused a filesort for some crazy reason (no noticeable performance impact though) --- RELEASE-NOTES | 1 + includes/api/ApiQueryAllpages.php | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a00c7213ae..7c8bd89999 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -313,6 +313,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 13735) Added prop=categoryinfo module * (bug 13945) Retrieve cascading protection sources via inprop=protection * (bug 13965) Hardcoded 51 limit on titles is too limiting +* (bug 13993) apfrom doesn't work with apdir=descending === Languages updated in 1.13 === diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index eb826f16fe..4758542e5e 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -60,8 +60,9 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { if (!$this->addWhereIf('page_is_redirect = 1', $params['filterredir'] === 'redirects')) $this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects'); $this->addWhereFld('page_namespace', $params['namespace']); - if (!is_null($params['from'])) - $this->addWhere('page_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from']))); + $dir = ($params['dir'] == 'descending' ? 'older' : 'newer'); + $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from'])); + $this->addWhereRange('page_title', $dir, $from, null); if (isset ($params['prefix'])) $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'"); @@ -124,9 +125,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $limit = $params['limit']; $this->addOption('LIMIT', $limit+1); - $this->addOption('ORDER BY', 'page_namespace, page_title' . - ($params['dir'] == 'descending' ? ' DESC' : '')); - $res = $this->select(__METHOD__); $data = array (); -- 2.20.1